﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Billing.DataObjects;

namespace Billing.Transactions
{
    public partial class ProcessingPaymentOrdersForm : Billing.WindowsBase.FormBase
    {
        public ProcessingPaymentOrdersForm()
        {
            InitializeComponent();
        }
        BillingDataContext mBillingDataContext;
        public BillingDataContext BillingDataContext
        {
            get
            {
                if (mBillingDataContext == null)
                    mBillingDataContext = new BillingDataContext();
                return mBillingDataContext;
            }
            set { mBillingDataContext = value; }
        }
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnProcessing_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                this.btnProcessing.Enabled = false;
                BillingDataContext.CommandTimeout = 120;
                BillingDataContext.PaymentOrdersProcessing(this.dtProcessingDate.Value);
                this.Cursor = Cursors.Default;
                this.btnProcessing.Enabled = true;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                this.btnProcessing.Enabled = true;
                MessageBox.Show(ex.Message);
            }
        }
    }
}
